package com.wmm.fast.main.shop2simplefactory;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;

/**
 * 写写画画 收银业务
 * @Auther: Token360
 * @Date: 2018/9/5 14:41
 * @Description:
 */
public class ShopCashiersRebate implements ShopCashiersInterface {

    private static Logger log = LoggerFactory.getLogger(ShopCashiersRebate.class);

    private double rebate = 10d;

    public ShopCashiersRebate() {}
    public ShopCashiersRebate(double rebate) {
        this.rebate = rebate;
    }

    @Override
    public double acceptCash(double payMoney) {
        BigDecimal bdMoney = new BigDecimal(payMoney);
        BigDecimal bdRebate = new BigDecimal(rebate);
        BigDecimal result = bdMoney.multiply(bdRebate).divide(new BigDecimal(10));
        log.info("打[{}]折收银:[{}]",rebate,result.doubleValue());
        return result.doubleValue();
    }

}
